<?
//<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
require ("s_inc.php");
$rows = 20;
$page	  = $_REQUEST['page']?$_REQUEST['page']:1;
//權限
$db_member = &new db($scfg['db']['member']);
$catstring ='arrcity2[1][0] = "基隆市"
arrcity2[1][1] = "七堵區"
arrcity2[1][2] = "中山區"
arrcity2[1][3] = "中正區"
arrcity2[1][4] = "仁愛區"
arrcity2[1][5] = "安樂區"
arrcity2[1][6] = "信義區"
arrcity2[1][7] = "暖暖區"
arrcity2[2] = new Array()
arrcity2[2][0] = "台北市"
arrcity2[2][1] = "士林區"
arrcity2[2][2] = "大同區"
arrcity2[2][3] = "大安區"
arrcity2[2][4] = "中山區"
arrcity2[2][5] = "中正區"
arrcity2[2][6] = "內湖區"
arrcity2[2][7] = "文山區"
arrcity2[2][8] = "北投區"
arrcity2[2][9] = "松山區"
arrcity2[2][10] = "信義區"
arrcity2[2][11] = "南港區"
arrcity2[2][12] = "萬華區"
arrcity2[3] = new Array()
arrcity2[3][0] = "台北縣"
arrcity2[3][1] = "八里鄉"
arrcity2[3][2] = "三芝鄉"
arrcity2[3][3] = "三重市"
arrcity2[3][4] = "三峽鎮"
arrcity2[3][5] = "土城市"
arrcity2[3][6] = "中和市"
arrcity2[3][7] = "五股鄉"
arrcity2[3][8] = "平溪鄉"
arrcity2[3][9] = "永和市"
arrcity2[3][10] = "石門鄉"
arrcity2[3][11] = "石碇鄉"
arrcity2[3][12] = "汐止市"
arrcity2[3][13] = "坪林鄉"
arrcity2[3][14] = "林口鄉"
arrcity2[3][15] = "板橋市"
arrcity2[3][16] = "金山鄉"
arrcity2[3][17] = "泰山鄉"
arrcity2[3][18] = "烏來鄉"
arrcity2[3][19] = "貢寮鄉"
arrcity2[3][20] = "淡水鎮"
arrcity2[3][21] = "深坑鄉"
arrcity2[3][22] = "新店市"
arrcity2[3][23] = "新莊市"
arrcity2[3][24] = "瑞芳鎮"
arrcity2[3][25] = "萬里鄉"
arrcity2[3][26] = "樹林市"
arrcity2[3][27] = "雙溪鄉"
arrcity2[3][28] = "蘆洲市"
arrcity2[3][29] = "鶯歌鎮"
arrcity2[4] = new Array()
arrcity2[4][0] = "桃園縣"
arrcity2[4][1] = "八德市"
arrcity2[4][2] = "大園鄉"
arrcity2[4][3] = "大溪鎮"
arrcity2[4][4] = "中壢市"
arrcity2[4][5] = "平鎮市"
arrcity2[4][6] = "桃園市"
arrcity2[4][7] = "復興鄉"
arrcity2[4][8] = "新屋鄉"
arrcity2[4][9] = "楊梅鎮"
arrcity2[4][10] = "龍潭鄉"
arrcity2[4][11] = "龜山鄉"
arrcity2[4][12] = "蘆竹鄉"
arrcity2[4][13] = "觀音鄉"
arrcity2[5] = new Array()
arrcity2[5][0] = "新竹縣"
arrcity2[5][1] = "五峰鄉"
arrcity2[5][2] = "北埔鄉"
arrcity2[5][3] = "尖石鄉"
arrcity2[5][4] = "竹北市"
arrcity2[5][5] = "竹東鎮"
arrcity2[5][6] = "芎林鄉"
arrcity2[5][7] = "峨眉鄉"
arrcity2[5][8] = "湖口鄉"
arrcity2[5][9] = "新埔鎮"
arrcity2[5][10] = "新豐鄉"
arrcity2[5][11] = "橫山鄉"
arrcity2[5][12] = "關西鎮"
arrcity2[5][13] = "寶山鄉"
arrcity2[6] = new Array()
arrcity2[6][0] = "新竹市"
arrcity2[6][1] = "北區"
arrcity2[6][2] = "東區"
arrcity2[6][3] = "香山區"
arrcity2[7] = new Array()
arrcity2[7][0] = "苗栗縣"
arrcity2[7][1] = "三義鄉"
arrcity2[7][2] = "三灣鄉"
arrcity2[7][3] = "大湖鄉"
arrcity2[7][4] = "公館鄉"
arrcity2[7][5] = "竹南鎮"
arrcity2[7][6] = "西湖鄉"
arrcity2[7][7] = "卓蘭鎮"
arrcity2[7][8] = "南庄鄉"
arrcity2[7][9] = "後龍鎮"
arrcity2[7][10] = "苗栗市"
arrcity2[7][11] = "苑裡鎮"
arrcity2[7][12] = "泰安鄉"
arrcity2[7][13] = "通霄鎮"
arrcity2[7][14] = "造橋鄉"
arrcity2[7][15] = "獅潭鄉"
arrcity2[7][16] = "銅鑼鄉"
arrcity2[7][17] = "頭份鎮"
arrcity2[7][18] = "頭屋鄉"
arrcity2[8] = new Array()
arrcity2[8][0] = "台中縣"
arrcity2[8][1] = "大甲鎮"
arrcity2[8][2] = "大安鄉"
arrcity2[8][3] = "大肚鄉"
arrcity2[8][4] = "大里市"
arrcity2[8][5] = "大雅鄉"
arrcity2[8][6] = "太平市"
arrcity2[8][7] = "外埔鄉"
arrcity2[8][8] = "石岡鄉"
arrcity2[8][9] = "后里鄉"
arrcity2[8][10] = "沙鹿鎮"
arrcity2[8][11] = "和平鄉"
arrcity2[8][12] = "東勢鎮"
arrcity2[8][13] = "烏日鄉"
arrcity2[8][14] = "神岡鄉"
arrcity2[8][15] = "梧棲鎮"
arrcity2[8][16] = "清水鎮"
arrcity2[8][17] = "新社鄉"
arrcity2[8][18] = "潭子鄉"
arrcity2[8][19] = "龍井鄉"
arrcity2[8][20] = "豐原市"
arrcity2[8][21] = "霧峰鄉"
arrcity2[9] = new Array()
arrcity2[9][0] = "台中市"
arrcity2[9][1] = "中區"
arrcity2[9][2] = "北屯區"
arrcity2[9][3] = "北區"
arrcity2[9][4] = "西屯區"
arrcity2[9][5] = "西區"
arrcity2[9][6] = "東區"
arrcity2[9][7] = "南屯區"
arrcity2[9][8] = "南區"
arrcity2[10] = new Array()
arrcity2[10][0] = "彰化縣"
arrcity2[10][1] = "二水鄉"
arrcity2[10][2] = "二林鎮"
arrcity2[10][3] = "大村鄉"
arrcity2[10][4] = "大城鄉"
arrcity2[10][5] = "北斗鎮"
arrcity2[10][6] = "永靖鄉"
arrcity2[10][7] = "田中鎮"
arrcity2[10][8] = "田尾鄉"
arrcity2[10][9] = "竹塘鄉"
arrcity2[10][10] = "伸港鄉"
arrcity2[10][11] = "秀水鄉"
arrcity2[10][12] = "和美鎮"
arrcity2[10][13] = "社頭鄉"
arrcity2[10][14] = "芳苑鄉"
arrcity2[10][15] = "花壇鄉"
arrcity2[10][16] = "芬園鄉"
arrcity2[10][17] = "員林鎮"
arrcity2[10][18] = "埔心鄉"
arrcity2[10][19] = "埔鹽鄉"
arrcity2[10][20] = "埤頭鄉"
arrcity2[10][21] = "鹿港鎮"
arrcity2[10][22] = "溪州鄉"
arrcity2[10][23] = "溪湖鎮"
arrcity2[10][24] = "彰化市"
arrcity2[10][25] = "福興鄉"
arrcity2[10][26] = "線西鄉"
arrcity2[11] = new Array()
arrcity2[11][0] = "南投縣"
arrcity2[11][1] = "中寮鄉"
arrcity2[11][2] = "仁愛鄉"
arrcity2[11][3] = "水里鄉"
arrcity2[11][4] = "名間鄉"
arrcity2[11][5] = "竹山鎮"
arrcity2[11][6] = "信義鄉"
arrcity2[11][7] = "南投市"
arrcity2[11][8] = "埔里鎮"
arrcity2[11][9] = "草屯鎮"
arrcity2[11][10] = "國姓鄉"
arrcity2[11][11] = "魚池鄉"
arrcity2[11][12] = "鹿谷鄉"
arrcity2[11][13] = "集集鎮"
arrcity2[12] = new Array()
arrcity2[12][0] = "雲林縣"
arrcity2[12][1] = "二崙鄉"
arrcity2[12][2] = "口湖鄉"
arrcity2[12][3] = "土庫鎮"
arrcity2[12][4] = "大埤鄉"
arrcity2[12][5] = "元長鄉"
arrcity2[12][6] = "斗六市"
arrcity2[12][7] = "斗南鎮"
arrcity2[12][8] = "水林鄉"
arrcity2[12][9] = "北港鎮"
arrcity2[12][10] = "古坑鄉"
arrcity2[12][11] = "台西鄉"
arrcity2[12][12] = "四湖鄉"
arrcity2[12][13] = "西螺鎮"
arrcity2[12][14] = "東勢鄉"
arrcity2[12][15] = "林內鄉"
arrcity2[12][16] = "虎尾鎮"
arrcity2[12][17] = "崙背鄉"
arrcity2[12][18] = "麥寮鄉"
arrcity2[12][19] = "莿桐鄉"
arrcity2[12][20] = "褒忠鄉"
arrcity2[13] = new Array()
arrcity2[13][0] = "嘉義縣"
arrcity2[13][1] = "大林鎮"
arrcity2[13][2] = "大埔鄉"
arrcity2[13][3] = "中埔鄉"
arrcity2[13][4] = "太保市"
arrcity2[13][5] = "水上鄉"
arrcity2[13][6] = "布袋鎮"
arrcity2[13][7] = "民雄鄉"
arrcity2[13][8] = "朴子市"
arrcity2[13][9] = "竹崎鄉"
arrcity2[13][10] = "阿里山鄉"
arrcity2[13][11] = "梅山鄉"
arrcity2[13][12] = "番路鄉"
arrcity2[13][13] = "新港鄉"
arrcity2[13][14] = "溪口鄉"
arrcity2[13][15] = "義竹鄉"
arrcity2[14] = new Array()
arrcity2[14][0] = "嘉義市"
arrcity2[14][1] = "西區"
arrcity2[14][2] = "東區"
arrcity2[15] = new Array()
arrcity2[15][0] = "台南縣"
arrcity2[15][1] = "仁德鄉"
arrcity2[15][2] = "六甲鄉"
arrcity2[15][3] = "北門鄉"
arrcity2[15][4] = "左鎮鄉"
arrcity2[15][5] = "永康市"
arrcity2[15][6] = "玉井鄉"
arrcity2[15][7] = "白河鎮"
arrcity2[15][8] = "安定鄉"
arrcity2[15][9] = "西港鄉"
arrcity2[15][10] = "佳里鎮"
arrcity2[15][11] = "官田鄉"
arrcity2[15][12] = "東山鄉"
arrcity2[15][13] = "南化鄉"
arrcity2[15][14] = "後壁鄉"
arrcity2[15][15] = "柳營鄉"
arrcity2[15][16] = "麻豆鎮"
arrcity2[15][17] = "善化鎮"
arrcity2[15][18] = "新化鎮"
arrcity2[15][19] = "新市鄉"
arrcity2[15][20] = "新營市"
arrcity2[15][21] = "楠西鄉"
arrcity2[15][22] = "學甲鎮"
arrcity2[15][23] = "龍崎鄉"
arrcity2[15][24] = "歸仁鄉"
arrcity2[15][25] = "關廟鄉"
arrcity2[15][26] = "鹽水鎮"
arrcity2[16] = new Array()
arrcity2[16][0] = "台南市"
arrcity2[16][1] = "中區"
arrcity2[16][2] = "北區"
arrcity2[16][3] = "安平區"
arrcity2[16][4] = "安南區"
arrcity2[16][5] = "西區"
arrcity2[16][6] = "東區"
arrcity2[16][7] = "南區"
arrcity2[17] = new Array()
arrcity2[17][0] = "高雄縣"
arrcity2[17][1] = "三民鄉"
arrcity2[17][2] = "大社鄉"
arrcity2[17][3] = "大寮鄉"
arrcity2[17][4] = "大樹鄉"
arrcity2[17][5] = "仁武鄉"
arrcity2[17][6] = "內門鄉"
arrcity2[17][7] = "六龜鄉"
arrcity2[17][8] = "永安鄉"
arrcity2[17][9] = "田寮鄉"
arrcity2[17][10] = "甲仙鄉"
arrcity2[17][11] = "杉林鄉"
arrcity2[17][12] = "岡山鎮"
arrcity2[17][13] = "林園鄉"
arrcity2[17][14] = "阿蓮鄉"
arrcity2[17][15] = "美濃鎮"
arrcity2[17][16] = "茄萣鄉"
arrcity2[17][17] = "茂林鄉"
arrcity2[17][18] = "桃源鄉"
arrcity2[17][19] = "梓官鄉"
arrcity2[17][20] = "鳥松鄉"
arrcity2[17][21] = "湖內鄉"
arrcity2[17][22] = "路竹鄉"
arrcity2[17][23] = "旗山鎮"
arrcity2[17][24] = "鳳山市"
arrcity2[17][25] = "橋頭鄉"
arrcity2[17][26] = "燕巢鄉"
arrcity2[17][27] = "彌陀鄉"
arrcity2[18] = new Array()
arrcity2[18][0] = "高雄市"
arrcity2[18][1] = "三民區"
arrcity2[18][2] = "小港區"
arrcity2[18][3] = "左營區"
arrcity2[18][4] = "前金區"
arrcity2[18][5] = "前鎮區"
arrcity2[18][6] = "苓雅區"
arrcity2[18][7] = "新興區"
arrcity2[18][8] = "楠梓區"
arrcity2[18][9] = "鼓山區"
arrcity2[18][10] = "旗津區"
arrcity2[18][11] = "鹽埕區"
arrcity2[19] = new Array()
arrcity2[19][0] = "屏東縣"
arrcity2[19][1] = "九如鄉"
arrcity2[19][2] = "三地門鄉"
arrcity2[19][3] = "內埔鄉"
arrcity2[19][4] = "竹田鄉"
arrcity2[19][5] = "牡丹鄉"
arrcity2[19][6] = "車城鄉"
arrcity2[19][7] = "里港鄉"
arrcity2[19][8] = "佳冬鄉"
arrcity2[19][9] = "來義鄉"
arrcity2[19][10] = "枋山鄉"
arrcity2[19][11] = "枋寮鄉"
arrcity2[19][12] = "東港鎮"
arrcity2[19][13] = "林邊鄉"
arrcity2[19][14] = "長治鄉"
arrcity2[19][15] = "南州鄉"
arrcity2[19][16] = "屏東市"
arrcity2[19][17] = "恆春鎮"
arrcity2[19][18] = "春日鄉"
arrcity2[19][19] = "崁頂鄉"
arrcity2[19][20] = "泰武鄉"
arrcity2[19][21] = "琉球鄉"
arrcity2[19][22] = "高樹鄉"
arrcity2[19][23] = "新埤鄉"
arrcity2[19][24] = "新園鄉"
arrcity2[19][25] = "萬丹鄉"
arrcity2[19][26] = "萬巒鄉"
arrcity2[19][27] = "滿州鄉"
arrcity2[19][28] = "潮州鎮"
arrcity2[19][29] = "麟洛鄉"
arrcity2[19][30] = "鹽埔鄉"
arrcity2[20] = new Array()
arrcity2[20][0] = "宜蘭縣"
arrcity2[20][1] = "三星鄉"
arrcity2[20][2] = "大同鄉"
arrcity2[20][3] = "五結鄉"
arrcity2[20][4] = "冬山鄉"
arrcity2[20][5] = "壯圍鄉"
arrcity2[20][6] = "宜蘭市"
arrcity2[20][7] = "南澳鄉"
arrcity2[20][8] = "員山鄉"
arrcity2[20][9] = "頭城鎮"
arrcity2[20][10] = "礁溪鄉"
arrcity2[20][11] = "羅東鎮"
arrcity2[20][12] = "蘇澳鎮"
arrcity2[21] = new Array()
arrcity2[21][0] = "花蓮縣"
arrcity2[21][1] = "玉里鎮"
arrcity2[21][2] = "光復鄉"
arrcity2[21][3] = "吉安鄉"
arrcity2[21][4] = "秀林鄉"
arrcity2[21][5] = "卓溪鄉"
arrcity2[21][6] = "花蓮市"
arrcity2[21][7] = "富里鄉"
arrcity2[21][8] = "新城鄉"
arrcity2[21][9] = "瑞穗鄉"
arrcity2[21][10] = "萬榮鄉"
arrcity2[21][11] = "壽豐鄉"
arrcity2[21][12] = "鳳林鎮"
arrcity2[21][13] = "豐濱鄉"
arrcity2[22] = new Array()
arrcity2[22][0] = "台東縣"
arrcity2[22][1] = "大武鄉"
arrcity2[22][2] = "太麻里鄉"
arrcity2[22][3] = "台東市"
arrcity2[22][4] = "成功鎮"
arrcity2[22][5] = "池上鄉"
arrcity2[22][6] = "卑南鄉"
arrcity2[22][7] = "延平鄉"
arrcity2[22][8] = "東河鄉"
arrcity2[22][9] = "金峰鄉"
arrcity2[22][10] = "長濱鄉"
arrcity2[22][11] = "海端鄉"
arrcity2[22][12] = "鹿野鄉"
arrcity2[22][13] = "達仁鄉"
arrcity2[22][14] = "關山鎮"
arrcity2[22][15] = "蘭嶼鄉"';
//$db_goods = &new db($scfg['db']['goods']);
//$catstring =
$catstring = explode("= new Array",$catstring);

echo count($catstring);
foreach($catstring as &$v)
{
	$tmp = explode('= "',$v);
	for($i=1;$i<count($tmp);$i++)
	{
		$t = explode('"',$tmp[$i]);
		$t = $t[0];
		if($i == 1)
		{
			$bind = array('name'=>$t);
			$id = $db_member->insert("area_c1",$bind);
		}else
		{
			$bind = array('name'=>$t,'a1id'=>$id );
			$db_member->insert("area_c2",$bind);
		}
	}
	
	/*第一次分类
	if($v['super'] == '0')
	{
		$bind = array(
			'name'=>$v['name'],
			'taxis'=>0,
			'tbid'=>$v['tbid'],
		);
		$id = $db_goods->insert("cats_c1",$bind);
	}
	/*/
	/*第二次分类
	$c = $db_goods->rsArray("select * from `cats_c1` where tbid = ? ",$v['super']);
	if($c['c1id'])
	{
		$bind = array(
			'c1id'=>$c['c1id'],
			'name'=>$v['name'],
			'taxis'=>0,
			'tbid'=>$v['tbid'],
		);
		$id = $db_goods->insert('cats_c2',$bind);
		if($id)
		{
			$db_goods->update("cats_c1",array("sub"=>"1")," c1id = ? ",$c['c1id']);
		}
	}
	//*/
	/*第三次分类
	$c = $db_goods->rsArray("select * from `cats_c2` where tbid = ? ",$v['super']);
	if($c['c2id'])
	{
		$bind = array(
			'c1id'=>$c['c1id'],
			'c2id'=>$c['c2id'],
			'name'=>$v['name'],
			'taxis'=>0,
			'tbid'=>$v['tbid'],
		);
		$id = $db_goods->insert('cats_c3',$bind);
		if($id)
		{
			$db_goods->update("cats_c2",array("sub"=>"1")," c2id = ? ",$c['c2id']);
		}
	}
	//*/
	/*第4次分类
	$c = $db_goods->rsArray("select * from `cats_c3` where tbid = ? ",$v['super']);
	if($c['c3id'])
	{
		$bind = array(
			'c1id'=>$c['c1id'],
			'c2id'=>$c['c2id'],
			'c3id'=>$c['c3id'],
			'name'=>$v['name'],
			'taxis'=>0,
			'tbid'=>$v['tbid'],
		);
		$id = $db_goods->insert('cats_c4',$bind);
		if($id)
		{
			$db_goods->update("cats_c3",array("sub"=>"1")," c3id = ? ",$c['c3id']);
		}
	}
	//*/
}
//print_r($catstring);

